#pragma once
#include "Map.h"
#include "BSP.h"

class CityMap : public Map{
public:
	CityMap(Character* aHero, int aSeed, int aBiome);
	virtual ~CityMap(){};

	Node GetHeroSpawn(int facing = -1);

private:
	// main data
	Tab2D<Tile> _BackTiles;
	vector<Node> wellList;

	// Main generator
	void GenerateMapData();

	// global methods
	int placeCityGrid(vector<sRectangle> aBorders, int aObject, bool aDoors = false);

	// backTiles methods
	// technical
	int placeArea(vector<sRectangle> aBorders, int aObject, bool aDoors = false);
	void placeRectangle(sRectangle aRect, int aObject, int aFloor = FLOOR_NONE);
	void placeFloor(sRectangle aRect, int aFloor);
	int objectsNextTo(Node aActual, int aObject);
	void pasteBackTiles(sRectangle aRect, bool aRot);
		void flipBackTiles(bool aV);

	// abstract
	void arrangeRoom(sRectangle aRect, int aRoom);
	void placeRandomTrees();

	// buildings
	void generatePalace(sRectangle aRect);
	void generateTemple(sRectangle aRect);
	void generateShop(sRectangle aRect, int aShop);
	void generateInn(sRectangle aRect);
	void generateHouse(sRectangle aRect);
	void generateGraveyard(sRectangle aRect);
	void generateMarket(sRectangle aRect);
};